
<header class="uc_head">
    <h3>百度地图</h3>
</header>

<section class="user_form">
    <form action="{url:/ucenter/complain_edit}" method="post" >
        <dl>
            <dt>地址:</dt>
            <dd>
                <input name="title" type="text" pattern='required' alt='地址不能为空' class="input_text" />
                <label>*地址不能为空</label>
            </dd>
        </dl>
        <dl>
            <dt></dt>
            <dd><input class="input_submit" type="submit" id="search" value="搜索" />
                <input class="input_submit" type="submit" id="showmap" value="展示地图" />
            </dd>
        </dl>
        <div id="show" style="width: 210px;height: 200px"></div>
        <div id="allview" style="width: 201px;height: 200px;margin-top: 5px"></div>
    </form>
</section>
<script type="text/javascript">
    // 百度地图API功能
    $('#showmap').click(function () {
        var map = new BMap.Map("show");
        var point = new BMap.Point(116.331398,39.897445);
        map.centerAndZoom(point,12);
        var geoc = new BMap.Geocoder();

        map.addEventListener("click", function(e){
            var pt = e.point;
            geoc.getLocation(pt, function(rs){
                var addComp = rs.addressComponents;
                alert(addComp.province + ", " + addComp.city + ", " + addComp.district + ", " + addComp.street + ", " + addComp.streetNumber);
            });
        });
    })

</script>


